package ccpvspiral1;

import java.util.ArrayList;


public class DatedValues<T> {

	private int date;
	private int qty;
	private ArrayList<T> values = new ArrayList<T>();
    
	
	public DatedValues() {
		date = 0;
		qty = 0;
	}
	
	public DatedValues(int date, T value) {
		this.setDate(date);
		this.addValue(value);
	}

	public DatedValues(int date, int qty, ArrayList<T> values) {
		this.setDate(date);
		this.setQty(qty);
		for(T val: values) {
			this.values.add(val);
		}
	}

	private void addValue(T value2) {
		values.add(value2);
	}

	/**
	 * @param date the date to set
	 */
	public void setDate(int date) {
		this.date = date;
	}

	/**
	 * @return the date
	 */
	public int getDate() {
		return date;
	}

	/**
	 * @param value the value to set
	 */
	public void setValues(ArrayList<T> values2) {
		this.values.clear();
		for(T val: values2) {
			this.values.add(val);
		}
	}

	/**
	 * @return the value
	 */
	public ArrayList<T> getValues() {
		return values;
	}
	
	public T getValueAt(int i) {
		return values.get(i);
	}
	
	public String toString() {
		String st = "(";
		st = st + date;
		for (T value: values) {
		  st = st + ", " + value.toString();	
		}
		st = st + ")";
		return st;
	}

	/**
	 * @param qty the qty to set
	 */
	public void setQty(int qty) {
		this.qty = qty;
	}

	/**
	 * @return the qty
	 */
	public int getQty() {
		return qty;
	}
}
